<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
      <el-form-item label="设备编号" prop="devicecode">
        <el-input
          v-model="queryParams.devicecode"
          placeholder="请输入设备编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="设备类别" prop="devicetype">
        <el-input
          v-model="queryParams.devicetype"
          placeholder="请输入设备类别"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="科室/部门" prop="useoffice">
        <el-select v-model="queryParams.useoffice" placeholder="请选择科室/部门" clearable size="small">
          <el-option
            v-for="dict in useofficeOptions"
            :key="dict.deptId"
            :label="dict.deptName"
            :value="dict.deptId"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="安装日期">-->
<!--        <el-date-picker-->
<!--          v-model="daterangeInstalldate"-->
<!--          size="small"-->
<!--          style="width: 240px"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          type="daterange"-->
<!--          range-separator="-"-->
<!--          start-placeholder="开始日期"-->
<!--          end-placeholder="结束日期"-->
<!--        ></el-date-picker>-->
<!--      </el-form-item>-->
      <el-form-item label="生产厂家" prop="factory">
        <el-input
          v-model="queryParams.factory"
          placeholder="请输入生产厂家"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      </el-form-item>


      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['zyx:device:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['zyx:device:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['zyx:device:remove']"
        >删除</el-button>
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['zyx:device:export']"
        >导出</el-button>
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="单位名称" align="center" prop="unitname" />
      <el-table-column label="设备编号" align="center" prop="devicecode" />
       <el-table-column label="设备型号" align="center" prop="devicemodel" />
      <el-table-column label="设备类别" align="center" prop="devicetype"  />
      <el-table-column label="科室/部门" align="center" prop="useoffice" :formatter="useofficeFormat" />
      <el-table-column label="安装日期" align="center" prop="installdate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.installdate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产厂家" align="center" prop="factory" />
      <el-table-column label="供应商" align="center" prop="supplier" />
      <el-table-column label="责任人" align="center" prop="dutyuser" />
      <el-table-column label="是否保养" align="center"  >
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.istake"
            active-value="1"
            inactive-value="0"
            @change="handleIstakeStatusChange(scope.row)"
          ></el-switch>
        </template>
       </el-table-column>
      <el-table-column label="是否检定" align="center" prop="ischeck" >
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.ischeck"
            active-value="1"
            inactive-value="0"
            @change="handleIscheckStatusChange(scope.row)"
          ></el-switch>
        </template>
         </el-table-column>
      <el-table-column label="是否建立档案" align="center" prop="isrecord" >
          <template slot-scope="scope">
            <el-switch
              v-model="scope.row.isrecord"
              active-value="1"
              inactive-value="0"
              @change="handleIsrecordStatusChange(scope.row)"
            ></el-switch>
          </template>
       </el-table-column>
      <el-table-column label="是否调拨" align="center" prop="isallot" :formatter="isallotFormat" >
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.isallot"
            active-value="1"
            inactive-value="0"
            @change="handleIsallotStatusChange(scope.row)"
          ></el-switch>
        </template>
         </el-table-column>
      <el-table-column label="是否合算运维" align="center" prop="isoperation" :formatter="isoperationFormat" >
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.isoperation"
            active-value="1"
            inactive-value="0"
            @change="handleIsoperationChange(scope.row)"
          ></el-switch>
        </template>
         </el-table-column>
      <el-table-column label="风险等级" align="center" prop="dangerlevel" :formatter="dangerlevelFormat" />
      <el-table-column label="资产编号" align="center" prop="propertycode" />
      <el-table-column label="出厂编号" align="center" prop="leavecode" />
      <el-table-column label="资产原值" align="center" prop="propertyvalue" />
      <el-table-column label="折旧年限" align="center" prop="depreciationyear" />
      <el-table-column label="是否投保" align="center" prop="isinsure" :formatter="isinsureFormat" />
      <el-table-column label="保修价格" align="center" prop="warrantyprice" />
      <el-table-column label="保修年限" align="center" prop="warrantydate" />
      <el-table-column label="投保单位" align="center" prop="insuredunit" :show-overflow-tooltip="true" />
      <el-table-column label="联系方式" align="center" prop="mobile" />
      <el-table-column label="备注信息" align="center" prop="remark" :show-overflow-tooltip="true" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['zyx:device:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['zyx:device:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改设备基础信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :close-on-click-modal="false">
      <el-form ref="form" :model="form" :rules="rules" label-width="90px">

        <el-form-item label="单位名称" prop="unitname">
          <el-input v-model="form.unitname" placeholder="请输入单位名称" maxlength="50"/>
        </el-form-item>
        <el-form-item label="设备编号" prop="devicecode">
          <el-input v-model="form.devicecode" placeholder="请输入设备编号" maxlength="50"/>
        </el-form-item>
        <el-form-item label="设备型号" prop="devicemodel">
          <el-input v-model="form.devicemodel" placeholder="请输入设备型号" maxlength="50"/>
        </el-form-item>
        <el-form-item label="设备类别" prop="devicetype">
           <el-input v-model="form.devicetype" placeholder="请输入设备类别" maxlength="50"/>
          <!-- <el-select v-model="form.devicetype" placeholder="请选择设备类别">
            <el-option
              v-for="dict in devicetypeOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select> -->
        </el-form-item>
        <el-form-item label="科室/部门" prop="useoffice">
          <el-select v-model="form.useoffice" placeholder="请选择使用科室">
            <el-option
              v-for="dict in useofficeOptions"
              :key="dict.deptId"
              :label="dict.deptName"
              :value="dict.deptId"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="安装日期" prop="installdate">
          <el-date-picker clearable size="small"
            v-model="form.installdate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择安装日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产厂家" prop="factory">
          <el-input v-model="form.factory" placeholder="请输入生产厂家" maxlength="50"/>
        </el-form-item>
        <el-form-item label="供应商" prop="supplier">
          <el-input v-model="form.supplier" placeholder="请输入供应商" maxlength="50"/>
        </el-form-item>
        <el-form-item label="责任人" prop="dutyuser">
          <el-input v-model="form.dutyuser" placeholder="请输入责任人" maxlength="50"/>
        </el-form-item>

        <el-form-item label="风险等级" prop="dangerlevel">
          <el-select v-model="form.dangerlevel" placeholder="请选择风险等级">
            <el-option
              v-for="dict in dangerlevelOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="资产编号" prop="propertycode">
          <el-input v-model="form.propertycode" placeholder="请输入资产编号" maxlength="50"/>
        </el-form-item>
        <el-form-item label="出厂编号" prop="leavecode">
          <el-input v-model="form.leavecode" placeholder="请输入出厂编号" maxlength="50"/>
        </el-form-item>
        <el-form-item label="资产原值" prop="propertyvalue" >
          <el-input v-model="form.propertyvalue"  placeholder="请输入资产原值"  maxlength="12"/>
        </el-form-item>
        <el-form-item label="折旧年限" prop="depreciationyear">
          <el-input  v-model="form.depreciationyear" placeholder="请输入折旧年限" maxlength="12"/>
        </el-form-item>
        <!-- <el-form-item label="是否投保" prop="isinsure">
          <el-input v-model="form.isinsure" placeholder="请输入是否投保" />
        </el-form-item> -->
        <el-form-item label="是否投保" prop="isinsure">
          <el-select v-model="form.isinsure" placeholder="请选择是否投保">
            <el-option
              v-for="dict in isinsureOptions"
              :key="dict.dictValue"
              :label="dict.dictLabel"
              :value="dict.dictValue"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="保修价格" prop="warrantyprice">
          <el-input v-model="form.warrantyprice"  placeholder="请输入保修价格" maxlength="12"/>
        </el-form-item>
        <el-form-item label="保修年限" prop="warrantydate">
          <el-input v-model="form.warrantydate" placeholder="请输入保修年限" maxlength="12"/>
        </el-form-item>
        <el-form-item label="投保单位" prop="insuredunit">
          <el-input v-model="form.insuredunit" placeholder="请输入投保单位" maxlength="50"/>
        </el-form-item>
        <el-form-item label="联系方式" prop="mobile">
          <el-input v-model="form.mobile" placeholder="请输入联系方式" maxlength="50"/>
        </el-form-item>
        <el-form-item label="备注信息" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" maxlength="200"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm" v-preventReClick="3000">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listDevice, getDevice, delDevice, addDevice, updateDevice, exportDevice,changeDeviceStatus } from "@/api/zyx/device";
import { listMyDept,  } from "@/api/system/dept";

export default {
  name: "Device",
  components: {
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 设备基础信息表格数据
      deviceList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 设备类别字典字典
      // devicetypeOptions: [],
      // 使用科室字典字典
      useofficeOptions: [],
      // 安装日期时间范围
      daterangeInstalldate: [],
      // 是否保养字典字典
      istakeOptions: [],
      // 是否检定字典
      ischeckOptions: [],
      // 是否建立档案字典
      isrecordOptions: [],
      // 是否调拨字典
      isallotOptions: [],
      // 是否合算运维字典
      isoperationOptions: [],
      // 风险等级字典
      dangerlevelOptions: [],
      // 是否投保字典
      isinsureOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        devicecode: null,
        devicetype: null,
        devicemodel:null,
        useoffice: null,
        installdate: null,
        factory: null,
        supplier: null,
        dutyuser: null,
        istake: null,
        ischeck: null,
        isrecord: null,
        isallot: null,
        isoperation: null,
        dangerlevel: null,
        propertycode: null,
        leavecode: null,
        propertyvalue: null,
        depreciationyear: null,
        isinsure: null,
        warrantyprice: null,
        warrantyperiod: null,
        insuredunit: null,
        mobile: null,
        unitname:null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        unitname: [
          { required: true, message: "单位名称不能为空", trigger: "change" }
        ],
        devicecode: [
          { required: true, message: "设备编号不能为空", trigger: "change" }
        ],
        devicemodel:[
          { required: true, message: "设备型号不能为空", trigger: "change" }
        ],
        devicetype: [
          { required: true, message: "设备类别不能为空", trigger: "change" }
        ],
        useoffice: [
          { required: true, message: "使用科室不能为空", trigger: "change" }
        ],
        installdate: [
          { required: true, message: "安装日期不能为空", trigger: "blur" }
        ],
        propertyvalue:[
          {
          pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})?$/,
          message: "请输入正确的资产原值(最多两位小数)",
          trigger: "blur"
        }
        ],
        depreciationyear:[
          {
          pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})?$/,
          message: "请输入正确的折旧年限(最多两位小数)",
          trigger: "blur"
        }
        ],
        warrantyprice:[
          {
          pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})?$/,
          message: "请输入正确的保修价格(最多两位小数)",
          trigger: "blur"
        }
        ],
        warrantydate:[
          {
          pattern: /^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})?$/,
          message: "请输入正确的保修年限(最多两位小数)",
          trigger: "blur"
        }
        ],
      }
    };
  },
  created() {

    this.getList();
    // this.getDicts("zyx_devicetype").then(response => {
    //   this.devicetypeOptions = response.data;
    // });
    // this.getDicts("zyx_dutyoffices").then(response => {
    //   this.useofficeOptions = response.data;
    // });
    listMyDept({deptType:'2'}).then(response => {
      console.log(response)
      this.useofficeOptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response => {
      this.istakeOptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response => {
      this.ischeckOptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response => {
      this.isrecordOptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response => {
      this.isallotOptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response => {
      this.isoperationOptions = response.data;
    });
    this.getDicts("zyx_dangerlevel").then(response => {
      this.dangerlevelOptions = response.data;
    });
    this.getDicts("sys_yes_no").then(response => {
      this.isinsureOptions = response.data;
    });

  },
  methods: {
    // 设备保养状态修改
    handleIstakeStatusChange(row) {
      let text = row.istake === "1" ? "添加到保养" : "从保养中移除";
      this.$confirm('确认要将设备"' + row.devicemodel + '""' + text + '"吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeDeviceStatus(row.id, row.istake,'1');
        }).then(() => {
          this.msgSuccess(text + "成功");
        }).catch(function() {
          row.istake = row.istake === "1" ? "0" : "1";
        });
    },
    // 设备检定状态修改
    handleIscheckStatusChange(row) {
      let text = row.ischeck === "1" ? "添加到检定" : "从检定中移除";
      this.$confirm('确认要将设备"' + row.devicemodel + '""' + text + '"吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeDeviceStatus(row.id, row.ischeck,'2');
        }).then(() => {
          this.msgSuccess(text + "成功");
        }).catch(function() {
          row.ischeck = row.ischeck === "1" ? "0" : "1";
        });
    },

    //设备档案状态修改
    handleIsrecordStatusChange(row) {
      let text = row.isrecord === "1" ? "建档" : "从建档中移除";
      this.$confirm('确认要将设备"' + row.devicemodel + '""' + text + '"吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeDeviceStatus(row.id, row.isrecord,'3');
        }).then(() => {
          this.msgSuccess(text + "成功");
        }).catch(function() {
          row.isrecord = row.isrecord === "1" ? "0" : "1";
        });
    },
    //设备调拨细状态修改
    handleIsallotStatusChange(row) {
      let text = row.isallot === "1" ? "添加到调拨" : "从调拨中移除";
      this.$confirm('确认要将设备"' + row.devicemodel + '""' + text + '"吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeDeviceStatus(row.id, row.isallot,'4');
        }).then(() => {
          this.msgSuccess(text + "成功");
        }).catch(function() {
          row.isallot = row.isallot === "1" ? "0" : "1";
        });
    },

    //设备调拨细状态修改
    handleIsoperationChange(row) {
      let text = row.isallot === "1" ? "添加到核算运维" : "从核算运维中移除";
      this.$confirm('确认要将设备"' + row.devicemodel + '""' + text + '"吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeDeviceStatus(row.id, row.isoperation,'5');
        }).then(() => {
          this.msgSuccess(text + "成功");
        }).catch(function() {
          row.isallot = row.isoperation === "1" ? "0" : "1";
        });
    },


    /** 查询设备基础信息列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeInstalldate && '' != this.daterangeInstalldate) {
        this.queryParams.params["beginInstalldate"] = this.daterangeInstalldate[0];
        this.queryParams.params["endInstalldate"] = this.daterangeInstalldate[1];
      }
      listDevice(this.queryParams).then(response => {
        this.deviceList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 设备类别字典字典翻译
    // devicetypeFormat(row, column) {
    //   return this.selectDictLabel(this.devicetypeOptions, row.devicetype);
    // },
    // 使用科室字典字典翻译
    useofficeFormat(row, column) {
      // console.log(this.selectDeptLabel(this.useofficeOptions, row.useoffice))
      return this.selectDeptLabel(this.useofficeOptions, row.useoffice);
    },
    // 是否保养字典字典翻译
    istakeFormat(row, column) {
      return this.selectDictLabel(this.istakeOptions, row.istake);
    },
    // 是否检定字典翻译
    ischeckFormat(row, column) {
      return this.selectDictLabel(this.ischeckOptions, row.ischeck);
    },
    // 是否建立档案字典翻译
    isrecordFormat(row, column) {
      return this.selectDictLabel(this.isrecordOptions, row.isrecord);
    },
    // 是否调拨字典翻译
    isallotFormat(row, column) {
      return this.selectDictLabel(this.isallotOptions, row.isallot);
    },
    // 是否合算运维字典翻译
    isoperationFormat(row, column) {
      return this.selectDictLabel(this.isoperationOptions, row.isoperation);
    },
    // 风险等级字典翻译
    dangerlevelFormat(row, column) {
      return this.selectDictLabel(this.dangerlevelOptions, row.dangerlevel);
    },
    // 是否投保字典翻译
    isinsureFormat(row, column) {
      return this.selectDictLabel(this.isinsureOptions, row.isinsure);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        departid: null,
        devicecode: null,
        devicetype: null,
        useoffice: null,
        installdate: null,
        factory: null,
        supplier: null,
        dutyuser: null,
        istake: null,
        ischeck: null,
        isrecord: null,
        isallot: null,
        isoperation: null,
        dangerlevel: null,
        propertycode: null,
        leavecode: null,
        propertyvalue: null,
        depreciationyear: null,
        isinsure: null,
        warrantyprice: null,
        warrantydate: null,
        insuredunit: null,
        mobile: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeInstalldate = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      console.log("12321321321");
      listMyDept({deptType:'2'}).then(response => {
        console.log(response)
        this.useofficeOptions = response.data;
      });

      this.reset();
      this.open = true;
      this.title = "添加设备基础信息";


    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      listMyDept({deptType:'2'}).then(response => {
        console.log(response)
        this.useofficeOptions = response.data;
      });

      this.reset();
      const id = row.id || this.ids
      getDevice(id).then(response => {


        this.form = response.data;



        this.form.useoffice = Number(this.form.useoffice); //转换下使用科室的类型
        this.open = true;
        this.title = "修改设备基础信息";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateDevice(this.form).then(response => {
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addDevice(this.form).then(response => {
              this.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除设备?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delDevice(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有设备基础信息数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportDevice(queryParams);
        }).then(response => {
          this.download(response.msg);
        })
    }
  }
};
</script>
